#include <pcre.h>
/////////////////////////////////
typedef struct Tag Tag;
struct Tag
{
	char *label;
	Tag *next;
};
typedef struct Tags Tags;
struct Tags
{
	Tag *first;
	Tag *next;
};
////////////////////////////////
typedef struct Index Index;
struct Index
{
	char *name; 
	int priority;
	Index *next;
};
typedef struct Indexs Indexs;
struct Indexs
{
	Index *first;
	Index *next;
};
///////////////////////////////
typedef struct Field Field;
struct Field
{
	char *name; 
	Field *next;
};
typedef struct Fields Fields;
struct Fields
{
	Field *first;
	Field *next;
};
///////////////////////////////
typedef struct Matcher Matcher;
struct Matcher
{
	int id;
	char *precheck;
	pcre *regex;
	Tags *Tags;
	Indexs *Indexs;
	Fields *Fields;
	Matcher *next;

};
typedef struct Matchers Matchers;
struct Matchers
{
	Matcher *first;
	Matcher *next;
};
///////////////////////////////

Tags *Tags_init();//
void Tags_free(Tags *Tags);
void Add_Tag(Tags *Tags, char *label);

Indexs *Indexs_init();//
void Indexs_free(Indexs *Indexs);
void Add_Index(Indexs *Indexs, char *name, int priority);

Fields *Fields_init();//
void Fields_free(Fields *Fields);
void Add_Field(Fields *Fields, char *name);

Matchers *Matchers_init();//
void Matchers_free(Matchers *Matchers);
void Add_Matcher(Matchers *Matchers, int id, char *precheck, pcre *regex, Tags *Tags, Indexs *Indexs, Fields *Fields);

void Print_Tags(Tags *Tags);
void Print_Indexs(Indexs *Indexs);
void Print_Fields(Fields *Fields);
void Print_Matchers(Matchers *Matchers);

int T_fgets(FILE *input, char *output);

int Timestamp( char* timestamp);
